<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>${constants.getSystemName()}</title>
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/expand/css/style.css?v=${constants.getReleaseVersion()}"
          media="all"/>

    <style>
        /** 卡片轮播图样式 */
        .admin-carousel .layui-carousel-ind {
            position: absolute;
            top: -41px;
            text-align: right;
        }

        .admin-carousel .layui-carousel-ind ul {
            background: 0 0;
        }

        .admin-carousel .layui-carousel-ind li {
            background-color: #e2e2e2;
        }

        .admin-carousel .layui-carousel-ind li .layui-this {
            background-color: #999;
        }

        /** 自定义样式*/
        .layui-bt-lwh-center {
            text-align: center
        }

        .layui-color-skyblue-lwh {
            background-color: #87CEEB !important
        }

        .layui-color-skyblue-lwh-delete {
            margin-top: 5px;
            /*background-color: #87CEEB !important*/
            color: #87CEEB !important
        }

        .layui-bg-lwh-schedule {
            background-color: #b9e0ee !important
        }

        .layui-height-lwh {
            height: 154px;
        }

        .layui-height-lwh-header {
            height: 30%;
        }

        .layui-height-lwh-body {
            height: 70%;
        }
        .layui-bg-lwh-share {
            background-color : #fcfae3 !important
        }
    </style>

</head>

<body>


<!-- 正文开始 -->
<div class="layui-fluid layui-form">
    <div class="layui-row layui-col-space15 ">

        <!-- 日程表-->
        <div class="layui-card layui-row layui-bg-lwh-share">
        <div class="layui-col-space15  layui-row layui-bg-lwh-schedule ">
            <!-- 自定义css layui-bg-lwh-schedule  -->
            <div class="layui-col-md3">
                <p class="lay-big-font  ">我的日程</p>
            </div>
        </div>

        <div id="showScheduleFormDraft" class=" layui-col-space15 layui-card-body " >
        </div>
        <div class="layui-col-space15 layui-card-body ">
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md3">
                <div class="layui-card layui-height-lwh">
                    <div class="layui-card-header layui-height-lwh-header">
                        <label>更多</label>
                    </div>
                    <div class="layui-card-body layui-height-lwh-body">
                        <div class="layui-bt-lwh-center ">  <!-- 自定义css layui-bt-lwh-center  -->
                            <button name="my_schedule_more" id="my_scheduleform_more" type="button" class="layui-btn layui-btn-primary layui-btn-lg layui-color-skyblue-lwh">
                                <i class="layui-icon ">&#xe65f;</i>
                            </button>
                        </div>
                        <p>&nbsp;</p>
                    </div>
                </div>
            </div>
        </div>
        </div>

        <!-- 日程框架-->
        <div class="layui-card layui-row layui-bg-lwh-share">
        <div class="layui-col-space15  layui-row layui-bg-lwh-schedule ">
            <!-- 自定义css layui-bg-lwh-schedule  -->
            <div class="layui-col-md3">
                <p class="lay-big-font  ">我的日程框架</p>
            </div>
        </div>

        <div id="showScheduleFrameDraft" class=" layui-col-space15 layui-card-body " >
        </div>
        <div class="layui-col-space15 layui-card-body">
            <div class="layui-col-xs12 layui-col-sm6 layui-col-md3">
                <div class="layui-card layui-height-lwh">
                    <div class="layui-card-header layui-height-lwh-header">
                        <label>更多</label>
                    </div>
                    <div class="layui-card-body layui-height-lwh-body">
                        <div class="layui-bt-lwh-center ">  <!-- 自定义css layui-bt-lwh-center  -->
                            <button name="my_schedule_more" id="my_scheduleframe_more" type="button" class="layui-btn layui-btn-primary layui-btn-lg layui-color-skyblue-lwh">
                                <i class="layui-icon ">&#xe65f;</i>
                            </button>
                        </div>
                        <p>&nbsp;</p>
                    </div>
                </div>
            </div>
        </div>
        </div>
    </div>

</div>

<!-- js部分 -->
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="/assets/common/libs/layui/layui.js"></script>
<script type="text/javascript" src="/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script>
    layui.use(['layer', 'carousel', 'form'], function() {

        var $ = layui.jquery;
        var layer = layui.layer;
        var carousel = layui.carousel;
        var device = layui.device;
        var form = layui.form;
        var buttomId = "全局变量";
        // 渲染轮播
        carousel.render({
            elem: '.layui-carousel',
            width: '100%',
            height: '60px',
            arrow: 'none',
            autoplay: true,
            trigger: device.ios || device.android ? 'click' : 'hover',
            anim: 'fade'
        });


        $(function() {
            $("#schedule_frame_create").click(function() {
                window.location.href = "/myScheduleFrame/addSframe";
            });
        });

        form.on('switch(schedule_frame_share)', function(data){
            var status=data.elem.checked
            var id=data.elem.id
            if (data.elem.checked){
                layer.msg("已选中id为："+id+"<br>statu为："+status,{time:1500,icon:1});
            };

            $.ajax({
                url:"/shareCommunity?status="+status+"&id="+id,
                type:"Post"
            });
            // layer.close(index);
        });

        //触发事件
        var active = {

            offset: function(othis) {
                var type = othis.data('type'),
                    bId = othis.data('id'),
                    text = "不删除可以吗?";
                buttomId=bId;
                layer.open({
                    type: 1,
                    title: "您将删除日程表",
                    offset: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                    ,id: bId + type //防止重复弹出
                    ,content: '<div style="padding: 20px 100px;">' + text + '</div>',
                    btn: ['不可以', '不删除'],
                    btnAlign: 'c' //按钮居中
                    ,shade: 0 //不显示遮罩
                    ,yes: function() {
                        layer.closeAll();
                        layer.msg("抱歉，您已删除成功。", {
                            time: 2000,
                            icon: 5
                        });
                    },
                    btn2: function() {
                        layer.closeAll();
                        layer.msg("恭喜您，您删除失败了。", {
                            time: 2000,
                            icon: 6
                        });
                    }
                });
            },
        };

        $('#deleteSchedule2 .layui-btn').on('click', function() {
            var othis = $(this),
                method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });

        $('#deleteSchedule1 .layui-btn').on('click', function() {
            var othis = $(this),
                method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });
        /**
         * author ho
         * param page_form 日程表 page_frame 日程框架
         * summary Ajax 加载
         * */

        $.post({
            url: "/myScheduleDraft/showMyScheduleDraft",
            success: function (json) {
                var scheduleForms = json.scheduleForms;
                alert(scheduleForms)
                var page_form = "";
                var page_frame = "";

                for (var i = 0; i < 3; i++) {

                    page_form += "                <!--日程表一-->\n" +
                        "                <div class=\"layui-col-xs12 layui-col-sm6 layui-col-md3 \">\n" +
                        "                    <div class=\"layui-card layui-height-lwh\">\n" +
                        "                        <div class=\"layui-card-header layui-height-lwh-header\">\n" +
                        "                            <label>创建时间：" + scheduleForms[i].creatTime + "</label>\n" +
                        "                            <button name=\"my_schedule_delete_1\" type=\"button\" class=\"layui-btn layui-btn-sm layui-btn-primary pull-right layui-color-skyblue-lwh-delete\">\n" +
                        "                                <i class=\"layui-icon\">&#xe640;</i>\n" +
                        "                            </button>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"layui-card-body layui-height-lwh-body \">\n" +
                        "                            <p class=\"lay-big-font\">" + scheduleForms[i].sformName + "</p>\n" +
                        "                            <p>你好空格&nbsp;<span class=\"pull-right\"><input type=\"checkbox\" name=\"my_schedule_open_1\" lay-skin=\"switch\" lay-text=\"公开|私有\" checked></span></p>\n" +
                        "                        </div>\n" +
                        "                    </div>\n" +
                        "                </div>"
                }
                /**
                 * frame scheduleForms =json.scheduleFrame
                 * type {string}
                 */

                for (var i = 0; i < 3; i++) {

                    page_frame += "                <!--日程表一-->\n" +
                        "                <div class=\"layui-col-xs12 layui-col-sm6 layui-col-md3 \">\n" +
                        "                    <div class=\"layui-card layui-height-lwh\">\n" +
                        "                        <div class=\"layui-card-header layui-height-lwh-header\">\n" +
                        "                            <label>创建时间：" + scheduleForms[i].creatTime + "</label>\n" +
                        "                            <button name=\"my_schedule_delete_1\" type=\"button\" class=\"layui-btn layui-btn-sm layui-btn-primary pull-right layui-color-skyblue-lwh-delete\">\n" +
                        "                                <i class=\"layui-icon\">&#xe640;</i>\n" +
                        "                            </button>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"layui-card-body layui-height-lwh-body \">\n" +
                        "                            <p class=\"lay-big-font\">" + scheduleForms[i].sformName + "</p>\n" +
                        "                            <p>你好空格&nbsp;<span class=\"pull-right\"><input type=\"checkbox\" name=\"schedule_frame_open_2\" lay-skin=\"switch\" lay-text=\"公开|私有\" checked></span></p>\n" +
                        "                        </div>\n" +
                        "                    </div>\n" +
                        "                </div>"
                }

                $("#showScheduleFormDraft").html(page_form);
                $("#showScheduleFrameDraft").html(page_frame);
            }

        });


    });
</script>

</body>

</html>
